package com.device.operating.service.impl;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.device.operating.dao.DepartmentRepository;
import com.device.operating.dao.FuncRepository;
import com.device.operating.dao.FunctypeRepository;
import com.device.operating.dao.GroupRepository;
import com.device.operating.dao.RoleRepository;
import com.device.operating.dao.UserRepository;
import com.device.operating.entity.Department;
import com.device.operating.entity.Func;
import com.device.operating.entity.Functype;
import com.device.operating.entity.Grouptab;
import com.device.operating.entity.Role;
import com.device.operating.entity.User;
import com.device.operating.service.DepartmentService;
import com.device.operating.service.FuncService;
import com.device.operating.service.FunctypeService;
import com.device.operating.service.GroupService;
import com.device.operating.service.RoleService;
import com.device.operating.service.UserService;

@Service("FunctypeService")
@Transactional(propagation=Propagation.REQUIRED)
public class FunctypeServiceImpl implements FunctypeService{
	
	@Autowired
	private FunctypeRepository FunctypeRepository;

	@Override
	public void addfunctype(Functype functype) {
		// TODO Auto-generated method stub
		FunctypeRepository.save(functype);
	}

	@Override
	public void deletefunctype(String functypeId) {
		// TODO Auto-generated method stub
		FunctypeRepository.delete(functypeId);
	}

	@Override
	public Functype queryone(String functypeId) {
		// TODO Auto-generated method stub
		return FunctypeRepository.findOne(functypeId);
	}

	@Override
	public Functype querybyfunctypecode(String functypecode) {
		// TODO Auto-generated method stub
		return FunctypeRepository.findByFunctypecode(functypecode);
	}

	@Override
	public List<Functype> querybyparentId(String parentId) {
		// TODO Auto-generated method stub
		return FunctypeRepository.findByParentId(parentId);
	}

	@Override
	public List<Functype> querybyFunctypesort(String functypesort) {
		// TODO Auto-generated method stub
		return FunctypeRepository.findByFunctypesort(functypesort);
	}
	
}
